#ifndef MAP_H
#define MAP_H

#include <fstream>
#include <math.h>

#include "mapFileReader.h"
#include "tile.h"

class Map
{
public:
	/// Name:		 Constructor
	/// Description: Opens a file and reades in it's data 
	///				 into the maps member data mapTileImageNames
	///				 and mapArray
	/// Param(s):	 (const char *) An exitsting map file name
	///	Return(s):	 (void) returns nothing
	Map( const char *MapName );

	/// Name:		 Copy constructor
	/// Description: Performs the correct coping procedure when 
	///				 passing a map to a funtion param or else 
	///				 where
	/// Param(s):	 (Map&) a reference to a map object
	/// Return(s):	 (void) returns nothing
	Map( Map &map );

	/// Name:		 Destructor
	/// Description: Calls mapSave() and Deletes the memeber 
	///				 variable mapArray and close the file streams
	/// Param(s):	 none
	/// Return(s):	 (void) returns nothing
	~Map();

	/// Name:		 setMapFile
	/// Description: Initiualizes all the private membors of a map
	/// Param(s):	 none
	/// Return(s):	 (void) returns nothing
	void setMapFile( const char *MapName );

	/// Name:		 push_backMapTileImageName
	/// Description: adds a image name to the list of images for this map
	///				 and returns the number in which the image is located 
	///				 in the MapTileImageName vector
	/// Param(s):	 none
	/// Return(s):	 (unsigned int
	unsigned int push_backMapTileImageName( std::string image );

	/// Name:		 getMapTileImageNames
	/// Description: gets the vector of map images
	/// Param(s):	 none
	/// Return(s):	 (std::vector<std::strings>) the vector of images
	std::vector<std::string> getMapTileImageNames();

	/// Name:		 getMapTiles
	/// Description: gets the array of map tiles
	/// Param(s):	 none
	/// Return(s):	 (Tile**) the array of map Tiles
	Tile **getMapTiles();

	/// Name:		 mapSave
	/// Description: Flashes the data in memory to the mapFileOut on the hard disk
	///				 on the hard drive
	/// Param(s):	 none
	/// Return(s):	 (void) return nothing
	void Save( const char *mapFileOut );

	/// Name:		 mapSave
	/// Description: Flashes the data in memory to the mapFileOut on the hard disk
	///				 on the hard drive
	/// Param(s):	 none
	/// Return(s):	 (void) return nothing
	void draw( sf::RenderWindow & app, bool showCollision );

private:
	/// stores the order and name of the images needed for this map
	std::vector<std::string> mapTileImageNames;

	/// stores the array of tiles for the map
	Tile **map;

	/// will be used to store the level of which floor this map is on
	unsigned int level;

	/// holds the collision box Image
	sf::Image collisionBoxImage;

	/// holds the collision box sprite
	sf::Sprite collisionBoxSprite;
};

/// helper functions
bool doesCollide( std::string &hexString );
unsigned int getNumber( std::string &hexString );

#endif